package com.luchao.back.service.impl;

import com.luchao.back.mapper.BrandsMapper;
import com.luchao.back.pojo.Brands;
import com.luchao.back.service.BrandsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BrandsServiceImpl implements BrandsService {

    @Autowired
    private BrandsMapper brandsMapper;

    @Override
    public List<Brands> getBrandsByPage(int pageNum, int pageSize) {
        return brandsMapper.getBrandsByPage((pageNum - 1) * pageSize, pageSize);
    }

    @Override
    public int addBrands(Brands brands) {
        return brandsMapper.addBrands(brands);
    }

    @Override
    public int editBrands(Brands brands) {
        return brandsMapper.editBrands(brands);
    }

    @Override
    public long getBrandsCount() {
        return brandsMapper.getBrandsCount();
    }

    @Override
    public boolean batchChangeState(List<Brands> list) {
        return brandsMapper.batchChangeState(list) > 0 ? true : false;
    }

    @Override
    public int checkBrands(String bname) {
        return brandsMapper.checkBrands(bname);
    }

    @Override
    public List<Brands> getAllBrands() {
        return brandsMapper.getAllBrands();
    }

    @Override
    public List<Brands> getAllBrandsForView() {
        return brandsMapper.getAllBrandsForView();
    }
}
